package com.glut.gultguy.controller;


import com.glut.gultguy.To.CommentTo;
import com.glut.gultguy.entity.Comment;
import com.glut.gultguy.mapper.CommentMapper;
import com.glut.gultguy.service.CommentService;
import com.glut.gultguy.utils.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-09-05
 */
@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private CommentService service;
    @Autowired
    private SnowflakeIdWorker idWorker;

    @Autowired(required = false)
    private CommentMapper mapper;


    @PostMapping("/setComment")
    @ResponseBody
    public boolean setComment(@RequestBody Comment comment){
        comment.set_id(idWorker.nextId()+"");
     return service.save(comment);
    }
}

